<?php

namespace catchAdmin\smstag\model;


use app\common\model\BaseModel;
use catchAdmin\smstag\model\search\SmsTagTrait;
use catchAdmin\smstopic\model\SmsTopic;
use catcher\base\CatchModel;
use catcher\base\CatchModel as Model;


class SmsTag extends CatchModel
{
    use SmsTagTrait;

    public $field = [
        //
        'id',
        //
        'title',
        'mapping_field',
        'sms_topic_id',
        'type',
        // 创建时间
        'created_at',
        // 更新时间
        'updated_at',
        // 软删除字段
        'deleted_at',
        // 创建人ID
        'creator_id',
    ];

    public $name = 'sms_tag';
    protected $paginate = false;

    public function getTagsByTopicId(int $topicId = 0)
    {

        $result = $this->alias("t1")->catchSearch()->catchLeftJoin(SmsTopic::class, "id", "sms_topic_id", ["model"])->field("t1.*")->select();
        return $result;


    }
}